package com.ty.xiaoyu.service;

import com.ty.xiaoyu.entity.SearchHistory;
import com.ty.xiaoyu.exception.SearchHistoryOperationException;

import java.util.List;

public interface SearchHistoryService {

    // 新增搜索记录
    void addSearchHistory(SearchHistory history) throws SearchHistoryOperationException;

    // 根据用户id获取搜索记录
    List<SearchHistory> getSearchHistoryByUserId(Integer pageIndex, Integer pageSize, String userId) throws SearchHistoryOperationException;

    // 根据用户id和搜索内容获取搜索记录
    SearchHistory getSearchHistoryByUserIdAndSearchText(String userId, String searchText);

    // 根据搜索记录id更新搜索记录（最后搜索时间）
    void updateSearchHistoryByHistory(SearchHistory history) throws SearchHistoryOperationException;

    // 根据用户id删除所有搜索记录
    void deleteAllSearchHistoryByUserId(String userId) throws SearchHistoryOperationException;
}
